/*
 * File:   TableTranscriberTest.cpp
 * Author: Guilherme Monteiro
 *
 */

#include "TableTranscriberTest.h"

CPPUNIT_TEST_SUITE_REGISTRATION(TableTranscriberTest);

TableTranscriberTest::TableTranscriberTest() {
}

TableTranscriberTest::~TableTranscriberTest() {
}

void TableTranscriberTest::setUp() {
}

void TableTranscriberTest::tearDown() {
}

void TableTranscriberTest::testRun1() {
    string p = "";
    try {
        TableTranscriber* tableTranscriber = new TableTranscriber(p, new Model1(), "");
    }
    catch(NullImageException &nie) {
        string msg = "ERROR ==> Image " + p + " can't be loaded. Change the image path or the directory of execution";
        if (strcmp(nie.what(), msg.c_str()) != 0) {
            CPPUNIT_ASSERT(false);
        }
    }
}

void TableTranscriberTest::testRun2() {
    string p = "/books";
    try {
        TableTranscriber* tableTranscriber = new TableTranscriber(p, new Model1(), "");
    }
    catch(NullImageException &nie) {
        string msg = "ERROR ==> Image " + p + " can't be loaded. Change the image path or the directory of execution";
        //printf("nie.what(): %s\n", nie.what());
        if (strcmp(nie.what(), msg.c_str()) != 0) {
            CPPUNIT_ASSERT(false);
        }
    }
}

void TableTranscriberTest::testRun3() {
    try {
        TableTranscriber* tableTranscriber = 
                new TableTranscriber("/books/caracterizacao/baixa_resolucao/image278.png", new Model1(), "aa");
    }
    catch(InvalidRotatedTagException &irte) {
        string msg = "ERROR ==> Invalid rotated tag.";
        if (strcmp(irte.what(), msg.c_str()) != 0) {
            CPPUNIT_ASSERT(false);
        }
    }
}

void TableTranscriberTest::testRun4() {
    try {
        TableTranscriber* tableTranscriber = 
                new TableTranscriber("/books/caracterizacao/baixa_resolucao/image278.png", new Model1(), "-nr");
    }
    catch(InvalidRotatedTagException &irte) {
        CPPUNIT_ASSERT(false);
    }
}

void TableTranscriberTest::testRun5() {
    try {
        TableTranscriber* tableTranscriber = 
                new TableTranscriber("/books/caracterizacao/baixa_resolucao/image133.png", new Model1(), "-r");
    }
    catch(InvalidRotatedTagException &irte) {
        CPPUNIT_ASSERT(false);
    }
}


